< Prev(J) / Next(K) > / View :

Filename: /text/sbasic/shared/03030106.xhp

(section: year) (bookmark: bm_id3148664)
Year function

Year 関数

Year Function [Runtime]
Year 関数 [実行時](hd_id3148664.1)

Returns the year from a serial date number that is generated by the DateSerial or the DateValue function.
DateSerial ないし DateValue 関数による日付データのシリアル変換値を基に、該当する年を返します。(par_id3149655.2)

(/section: year)

Syntax:
構文:(hd_id3154125.3)

Year (Number)
Year (Number)(par_id3147229.4)

Return value:
戻り値:(hd_id3154685.5)

Integer
整数(par_id3153970.6)

Parameters:
パラメータ:(hd_id3150440.7)

Number: Integer expression that contains the serial date number that is used to calculate the year.
Number: 年情報を得る日付データのシリアル変換値を示す数値表式。(par_id3163712.8)

This function is the opposite of the DateSerial function, and returns the year of a serial date. For example, the expression:
この関数は DateSerial 関数と逆方向の機能を担っており、日付データのシリアル変換値から該当する年を取得します。こうした点は、下記のコードを実行してみると分かりやすいでしょう。(par_id3152596.9)

Print Year(DateSerial(1994, 12, 20))
Print Year(DateSerial(1994, 12, 20))(par_id3154319.10)

returns the value 1994.
この場合の戻り値は 1994 となります。(par_id3149483.11)

(embed text/sbasic/shared/00000003.xhp#errorcode : linkinfo)

Error Codes

エラーコード(hd_id3152869.37)

(/embed text/sbasic/shared/00000003.xhp#errorcode)

(embed text/sbasic/shared/00000003.xhp#err5 : linkinfo)

5 Invalid procedure call
5 無効なプロシージャー呼び出しです (par_id3150891.41)

(/embed text/sbasic/shared/00000003.xhp#err5)

Example:
例:(hd_id3146985.12)

Sub ExampleYear
Sub ExampleYear(par_id3153952.13)

MsgBox "" & Year(Now) ,64,"Current year"
MsgBox "" & Year(Now) ,64,"Current year"(par_id3153363.14)

End sub
End sub(par_id3145274.15)


< Prev / Next >